package com.sen.common.tenant.config;

import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * 租户holder
 * @author esjiang
 */
public class TenantContextHolder {

    private static final ThreadLocal<String> CONTEXT = new TransmittableThreadLocal<>();

    public static void setTenant(String tenant) {
        CONTEXT.set(tenant);
    }

    public static String getTenant() {
        return CONTEXT.get();
    }

    public static void clear() {
        CONTEXT.remove();
    }
}
